﻿using Architecture.API.Application.Command.UserInfoCommand;
using Architecture.Domain.Service.UserInfoServices;
using MediatR;

namespace Architecture.API.Application.CommandHandlers.UserInfoHandler
{
    /// <summary>
    /// 
    /// </summary>
    public class UserInfoRemoveCommandHandler : IRequestHandler<UserInfoRemoveCommad, int>
    {
        /// <summary>
        /// 用户信息服务
        /// </summary>
        private readonly IUserInfoService _userInfoService;

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="userInfoService">用户信息服务</param>
        public UserInfoRemoveCommandHandler(IUserInfoService userInfoService)
        {
            _userInfoService = userInfoService;
        }

        public async Task<int> Handle(UserInfoRemoveCommad request, CancellationToken cancellationToken)
        {
            return await _userInfoService.DeletedAsync(request.UserId);
        }
    }
}
